<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>
<script>
  // 函数优化
  function add(a, b) {
    //判断b是否为空，为空就给默认值1
    b = b || 1;
    return a + b;
  }
  function add(a, b = 1) {
    return a + b;
  }
</script>
